<template>
  <div>
    <el-card class="box-card">
        <div slot="header" class="clearfix">
            <span class="span">楼栋管理</span>
            <el-form :inline="true" :model="formInline" class="demo-form-inline">
                <el-input v-model="formInline.user" class="input" placeholder="输入关键字进行筛选"></el-input>
            <el-form-item>
                <el-button type="primary" @click="onSubmit" size="mini">查询</el-button>
                <el-button type="success" @click="onSubmit" size="mini">添加小区</el-button>
            </el-form-item>
            </el-form>
        </div>
        <div  class="text item" > 
            <el-tree :data="data" node-key="id" :props="defaultProps" 
            >
                
            </el-tree>
        </div>
    </el-card>
      
  </div>
</template>

<script>
import {Storied} from '../utils/utils'
 export default {
    data() {
      return {
        formInline: {
          user: '',
          region: ''
        },
        data: [],
        defaultProps: {
          children: 'children',
          label: 'name'
        }
      };
    },
    mounted(){
        this.gitStoried()
    },
    methods: {
    async gitStoried(){
        const {data} = await Storied()
        this.data = data.list
        console.log(this.data)
    },
      handleNodeClick(data) {
        console.log(data);
      },
      onSubmit() {
        console.log('submit!');
      }
    }
  };
</script>

<style scoped>
  .text {
    font-size: 14px;
  }

  .item {
    margin-bottom: 18px;
  }

  /* .clearfix:before, */
  .clearfix:after {
    display: table;
    content: "";
    display: flex;
  }
  .clearfix:after {
    clear: both
  }
.clearfix{
    display: flex;
}
  .box-card {
    width: 90%;
  }
  .span{
      margin: 10px 0;
  }
  .input{
      width: 200px;
      margin: 0 20px;
  }
</style>